<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>svgpan.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_third_party_closure_goog_svgpan_svgpan.js.html">svgpan.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>/**
<a name="line2"></a> *  SVGPan library 1.2.2
<a name="line3"></a> * ======================
<a name="line4"></a> *
<a name="line5"></a> * Given an unique existing element with a given id (or by default, the first
<a name="line6"></a> * g-element), including the library into any SVG adds the following
<a name="line7"></a> * capabilities:
<a name="line8"></a> *
<a name="line9"></a> *  - Mouse panning
<a name="line10"></a> *  - Mouse zooming (using the wheel)
<a name="line11"></a> *  - Object dragging
<a name="line12"></a> *
<a name="line13"></a> * You can configure the behaviour of the pan/zoom/drag via setOptions().
<a name="line14"></a> *
<a name="line15"></a> * Known issues:
<a name="line16"></a> *
<a name="line17"></a> *  - Zooming (while panning) on Safari has still some issues
<a name="line18"></a> *
<a name="line19"></a> * Releases:
<a name="line20"></a> *
<a name="line21"></a> * 1.2.2, Tue Aug 30 17:21:56 CEST 2011, Andrea Leofreddi
<a name="line22"></a> *  - Fixed viewBox on root tag (#7)
<a name="line23"></a> *  - Improved zoom speed (#2)
<a name="line24"></a> *
<a name="line25"></a> * 1.2.1, Mon Jul  4 00:33:18 CEST 2011, Andrea Leofreddi
<a name="line26"></a> *  - Fixed a regression with mouse wheel (now working on Firefox 5)
<a name="line27"></a> *  - Working with viewBox attribute (#4)
<a name="line28"></a> *  - Added &quot;use strict;&quot; and fixed resulting warnings (#5)
<a name="line29"></a> *  - Added configuration variables, dragging is disabled by default (#3)
<a name="line30"></a> *
<a name="line31"></a> * 1.2, Sat Mar 20 08:42:50 GMT 2010, Zeng Xiaohui
<a name="line32"></a> *  Fixed a bug with browser mouse handler interaction
<a name="line33"></a> *
<a name="line34"></a> * 1.1, Wed Feb  3 17:39:33 GMT 2010, Zeng Xiaohui
<a name="line35"></a> *  Updated the zoom code to support the mouse wheel on Safari/Chrome
<a name="line36"></a> *
<a name="line37"></a> * 1.0, Andrea Leofreddi
<a name="line38"></a> *  First release
<a name="line39"></a> */
<a name="line40"></a>
<a name="line41"></a>/**
<a name="line42"></a> * @license
<a name="line43"></a> * This code is licensed under the following BSD license:
<a name="line44"></a> * Copyright 2009-2010 Andrea Leofreddi &lt;a.leofreddi@itcharm.com&gt;. All rights
<a name="line45"></a> * reserved.
<a name="line46"></a> *
<a name="line47"></a> * Redistribution and use in source and binary forms, with or without
<a name="line48"></a> * modification, are permitted provided that the following conditions are met:
<a name="line49"></a> *
<a name="line50"></a> *    1. Redistributions of source code must retain the above copyright notice,
<a name="line51"></a> *       this list of conditions and the following disclaimer.
<a name="line52"></a> *
<a name="line53"></a> *    2. Redistributions in binary form must reproduce the above copyright
<a name="line54"></a> *       notice, this list of conditions and the following disclaimer in the
<a name="line55"></a> *       documentation and/or other materials provided with the distribution.
<a name="line56"></a> *
<a name="line57"></a> * THIS SOFTWARE IS PROVIDED BY Andrea Leofreddi ``AS IS&#39;&#39; AND ANY EXPRESS OR
<a name="line58"></a> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
<a name="line59"></a> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
<a name="line60"></a> * EVENT SHALL Andrea Leofreddi OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
<a name="line61"></a> * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
<a name="line62"></a> * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
<a name="line63"></a> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
<a name="line64"></a> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<a name="line65"></a> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
<a name="line66"></a> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<a name="line67"></a> *
<a name="line68"></a> * The views and conclusions contained in the software and documentation are
<a name="line69"></a> * those of the authors and should not be interpreted as representing official
<a name="line70"></a> * policies, either expressed or implied, of Andrea Leofreddi.
<a name="line71"></a> *
<a name="line72"></a> */
<a name="line73"></a>
<a name="line74"></a>goog.provide(&#39;svgpan.SvgPan&#39;);
<a name="line75"></a>
<a name="line76"></a>goog.require(&#39;goog.Disposable&#39;);
<a name="line77"></a>goog.require(&#39;goog.events&#39;);
<a name="line78"></a>goog.require(&#39;goog.events.EventType&#39;);
<a name="line79"></a>goog.require(&#39;goog.events.MouseWheelHandler&#39;);
<a name="line80"></a>
<a name="line81"></a>
<a name="line82"></a>
<a name="line83"></a>/**
<a name="line84"></a> * Instantiates an SvgPan object.
<a name="line85"></a> * @param {string=} opt_graphElementId The id of the graph element.
<a name="line86"></a> * @param {Element=} opt_root An optional document root.
<a name="line87"></a> * @constructor
<a name="line88"></a> * @extends {goog.Disposable}
<a name="line89"></a> */
<a name="line90"></a>svgpan.SvgPan = function(opt_graphElementId, opt_root) {
<a name="line91"></a>  goog.base(this);
<a name="line92"></a>
<a name="line93"></a>  /** @private {Element} */
<a name="line94"></a>  this.root_ = opt_root || document.documentElement;
<a name="line95"></a>
<a name="line96"></a>  /** @private {?string} */
<a name="line97"></a>  this.graphElementId_ = opt_graphElementId || null;
<a name="line98"></a>
<a name="line99"></a>  /** @private {boolean} */
<a name="line100"></a>  this.cancelNextClick_ = false;
<a name="line101"></a>
<a name="line102"></a>  /** @private {boolean} */
<a name="line103"></a>  this.enablePan_ = true;
<a name="line104"></a>
<a name="line105"></a>  /** @private {boolean} */
<a name="line106"></a>  this.enableZoom_ = true;
<a name="line107"></a>
<a name="line108"></a>  /** @private {boolean} */
<a name="line109"></a>  this.enableDrag_ = false;
<a name="line110"></a>
<a name="line111"></a>  /** @private {number} */
<a name="line112"></a>  this.zoomScale_ = 0.4;
<a name="line113"></a>
<a name="line114"></a>  /** @private {svgpan.SvgPan.State} */
<a name="line115"></a>  this.state_ = svgpan.SvgPan.State.NONE;
<a name="line116"></a>
<a name="line117"></a>  /** @private {Element} */
<a name="line118"></a>  this.svgRoot_ = null;
<a name="line119"></a>
<a name="line120"></a>  /** @private {Element} */
<a name="line121"></a>  this.stateTarget_ = null;
<a name="line122"></a>
<a name="line123"></a>  /** @private {Element} */
<a name="line124"></a>  this.stateOrigin_ = null;
<a name="line125"></a>
<a name="line126"></a>  /** @private {SVGMatrix} */
<a name="line127"></a>  this.stateTf_ = null;
<a name="line128"></a>
<a name="line129"></a>  /** @private {goog.events.MouseWheelHandler} */
<a name="line130"></a>  this.mouseWheelHandler_ = null;
<a name="line131"></a>
<a name="line132"></a>  this.setupHandlers_();
<a name="line133"></a>};
<a name="line134"></a>goog.inherits(svgpan.SvgPan, goog.Disposable);
<a name="line135"></a>
<a name="line136"></a>
<a name="line137"></a>/** @override */
<a name="line138"></a>svgpan.SvgPan.prototype.disposeInternal = function() {
<a name="line139"></a>  goog.base(this, &#39;disposeInternal&#39;);
<a name="line140"></a>  goog.events.removeAll(this.root_);
<a name="line141"></a>  this.mouseWheelHandler_.dispose();
<a name="line142"></a>};
<a name="line143"></a>
<a name="line144"></a>
<a name="line145"></a>/**
<a name="line146"></a> * @enum {string}
<a name="line147"></a> */
<a name="line148"></a>svgpan.SvgPan.State = {
<a name="line149"></a>  NONE: &#39;none&#39;,
<a name="line150"></a>  PAN: &#39;pan&#39;,
<a name="line151"></a>  DRAG: &#39;drag&#39;
<a name="line152"></a>};
<a name="line153"></a>
<a name="line154"></a>
<a name="line155"></a>/**
<a name="line156"></a> * Enables/disables panning the entire SVG (default = true).
<a name="line157"></a> * @param {boolean} enabled Whether or not to allow panning.
<a name="line158"></a> */
<a name="line159"></a>svgpan.SvgPan.prototype.setPanEnabled = function(enabled) {
<a name="line160"></a>  this.enablePan_ = enabled;
<a name="line161"></a>};
<a name="line162"></a>
<a name="line163"></a>
<a name="line164"></a>/**
<a name="line165"></a> * Enables/disables zooming (default = true).
<a name="line166"></a> * @param {boolean} enabled Whether or not to allow zooming (default = true).
<a name="line167"></a> */
<a name="line168"></a>svgpan.SvgPan.prototype.setZoomEnabled = function(enabled) {
<a name="line169"></a>  this.enableZoom_ = enabled;
<a name="line170"></a>};
<a name="line171"></a>
<a name="line172"></a>
<a name="line173"></a>/**
<a name="line174"></a> * Enables/disables dragging individual SVG objects (default = false).
<a name="line175"></a> * @param {boolean} enabled Whether or not to allow dragging of objects.
<a name="line176"></a> */
<a name="line177"></a>svgpan.SvgPan.prototype.setDragEnabled = function(enabled) {
<a name="line178"></a>  this.enableDrag_ = enabled;
<a name="line179"></a>};
<a name="line180"></a>
<a name="line181"></a>
<a name="line182"></a>/**
<a name="line183"></a> * Sets the sensitivity of mousewheel zooming (default = 0.4).
<a name="line184"></a> * @param {number} scale The new zoom scale.
<a name="line185"></a> */
<a name="line186"></a>svgpan.SvgPan.prototype.setZoomScale = function(scale) {
<a name="line187"></a>  this.zoomScale_ = scale;
<a name="line188"></a>};
<a name="line189"></a>
<a name="line190"></a>
<a name="line191"></a>/**
<a name="line192"></a> * Registers mouse event handlers.
<a name="line193"></a> * @private
<a name="line194"></a> */
<a name="line195"></a>svgpan.SvgPan.prototype.setupHandlers_ = function() {
<a name="line196"></a>  goog.events.listen(this.root_, goog.events.EventType.CLICK,
<a name="line197"></a>      goog.bind(this.handleMouseClick_, this));
<a name="line198"></a>  goog.events.listen(this.root_, goog.events.EventType.MOUSEUP,
<a name="line199"></a>      goog.bind(this.handleMouseUp_, this));
<a name="line200"></a>  goog.events.listen(this.root_, goog.events.EventType.MOUSEDOWN,
<a name="line201"></a>      goog.bind(this.handleMouseDown_, this));
<a name="line202"></a>  goog.events.listen(this.root_, goog.events.EventType.MOUSEMOVE,
<a name="line203"></a>      goog.bind(this.handleMouseMove_, this));
<a name="line204"></a>  this.mouseWheelHandler_ = new goog.events.MouseWheelHandler(this.root_);
<a name="line205"></a>  goog.events.listen(this.mouseWheelHandler_,
<a name="line206"></a>      goog.events.MouseWheelHandler.EventType.MOUSEWHEEL,
<a name="line207"></a>      goog.bind(this.handleMouseWheel_, this));
<a name="line208"></a>};
<a name="line209"></a>
<a name="line210"></a>
<a name="line211"></a>/**
<a name="line212"></a> * Retrieves the root element for SVG manipulation. The element is then cached.
<a name="line213"></a> * @param {Document} svgDoc The document.
<a name="line214"></a> * @return {Element} The svg root.
<a name="line215"></a> * @private
<a name="line216"></a> */
<a name="line217"></a>svgpan.SvgPan.prototype.getRoot_ = function(svgDoc) {
<a name="line218"></a>  if (!this.svgRoot_) {
<a name="line219"></a>    var r = this.graphElementId_ ?
<a name="line220"></a>        svgDoc.getElementById(this.graphElementId_) : svgDoc.documentElement;
<a name="line221"></a>    var t = r;
<a name="line222"></a>    while (t != svgDoc) {
<a name="line223"></a>      if (t.getAttribute(&#39;viewBox&#39;)) {
<a name="line224"></a>        this.setCtm_(r, r.getCTM());
<a name="line225"></a>        t.removeAttribute(&#39;viewBox&#39;);
<a name="line226"></a>      }
<a name="line227"></a>      t = t.parentNode;
<a name="line228"></a>    }
<a name="line229"></a>    this.svgRoot_ = r;
<a name="line230"></a>  }
<a name="line231"></a>  return this.svgRoot_;
<a name="line232"></a>};
<a name="line233"></a>
<a name="line234"></a>
<a name="line235"></a>/**
<a name="line236"></a> * Instantiates an SVGPoint object with given event coordinates.
<a name="line237"></a> * @param {!goog.events.Event} evt The event with coordinates.
<a name="line238"></a> * @return {SVGPoint} The created point.
<a name="line239"></a> * @private
<a name="line240"></a> */
<a name="line241"></a>svgpan.SvgPan.prototype.getEventPoint_ = function(evt) {
<a name="line242"></a>  return this.newPoint_(evt.clientX, evt.clientY);
<a name="line243"></a>};
<a name="line244"></a>
<a name="line245"></a>
<a name="line246"></a>/**
<a name="line247"></a> * Instantiates an SVGPoint object with given coordinates.
<a name="line248"></a> * @param {number} x The x coordinate.
<a name="line249"></a> * @param {number} y The y coordinate.
<a name="line250"></a> * @return {SVGPoint} The created point.
<a name="line251"></a> * @private
<a name="line252"></a> */
<a name="line253"></a>svgpan.SvgPan.prototype.newPoint_ = function(x, y) {
<a name="line254"></a>  var p = this.root_.createSVGPoint();
<a name="line255"></a>  p.x = x;
<a name="line256"></a>  p.y = y;
<a name="line257"></a>  return p;
<a name="line258"></a>};
<a name="line259"></a>
<a name="line260"></a>
<a name="line261"></a>/**
<a name="line262"></a> * Sets the current transform matrix of an element.
<a name="line263"></a> * @param {Element} element The element.
<a name="line264"></a> * @param {SVGMatrix} matrix The transform matrix.
<a name="line265"></a> * @private
<a name="line266"></a> */
<a name="line267"></a>svgpan.SvgPan.prototype.setCtm_ = function(element, matrix) {
<a name="line268"></a>  var s = &#39;matrix(&#39; + matrix.a + &#39;,&#39; + matrix.b + &#39;,&#39; + matrix.c + &#39;,&#39; +
<a name="line269"></a>      matrix.d + &#39;,&#39; + matrix.e + &#39;,&#39; + matrix.f + &#39;)&#39;;
<a name="line270"></a>  element.setAttribute(&#39;transform&#39;, s);
<a name="line271"></a>};
<a name="line272"></a>
<a name="line273"></a>
<a name="line274"></a>/**
<a name="line275"></a> * Handle mouse wheel event.
<a name="line276"></a> * @param {!goog.events.Event} evt The event.
<a name="line277"></a> * @private
<a name="line278"></a> */
<a name="line279"></a>svgpan.SvgPan.prototype.handleMouseWheel_ = function(evt) {
<a name="line280"></a>  if (!this.enableZoom_)
<a name="line281"></a>    return;
<a name="line282"></a>
<a name="line283"></a>  // Prevents scrolling.
<a name="line284"></a>  evt.preventDefault();
<a name="line285"></a>
<a name="line286"></a>  var svgDoc = evt.target.ownerDocument;
<a name="line287"></a>
<a name="line288"></a>  var delta = evt.deltaY / -9;
<a name="line289"></a>  var z = Math.pow(1 + this.zoomScale_, delta);
<a name="line290"></a>  var g = this.getRoot_(svgDoc);
<a name="line291"></a>  var p = this.getEventPoint_(evt);
<a name="line292"></a>  p = p.matrixTransform(g.getCTM().inverse());
<a name="line293"></a>
<a name="line294"></a>  // Compute new scale matrix in current mouse position
<a name="line295"></a>  var k = this.root_.createSVGMatrix().translate(
<a name="line296"></a>      p.x, p.y).scale(z).translate(-p.x, -p.y);
<a name="line297"></a>  this.setCtm_(g, g.getCTM().multiply(k));
<a name="line298"></a>
<a name="line299"></a>  if (typeof(this.stateTf_) == &#39;undefined&#39;) {
<a name="line300"></a>    this.stateTf_ = g.getCTM().inverse();
<a name="line301"></a>  }
<a name="line302"></a>  this.stateTf_ =
<a name="line303"></a>      this.stateTf_ ? this.stateTf_.multiply(k.inverse()) : this.stateTf_;
<a name="line304"></a>};
<a name="line305"></a>
<a name="line306"></a>
<a name="line307"></a>/**
<a name="line308"></a> * Handle mouse move event.
<a name="line309"></a> * @param {!goog.events.Event} evt The event.
<a name="line310"></a> * @private
<a name="line311"></a> */
<a name="line312"></a>svgpan.SvgPan.prototype.handleMouseMove_ = function(evt) {
<a name="line313"></a>  if (evt.button != 0) {
<a name="line314"></a>    return;
<a name="line315"></a>  }
<a name="line316"></a>  this.handleMove(evt.clientX, evt.clientY, evt.target.ownerDocument);
<a name="line317"></a>};
<a name="line318"></a>
<a name="line319"></a>
<a name="line320"></a>/**
<a name="line321"></a> * Handles mouse motion for the given coordinates.
<a name="line322"></a> * @param {number} x The x coordinate.
<a name="line323"></a> * @param {number} y The y coordinate.
<a name="line324"></a> * @param {Element} svgDoc The svg document.
<a name="line325"></a> */
<a name="line326"></a>svgpan.SvgPan.prototype.handleMove = function(x, y, svgDoc) {
<a name="line327"></a>  var g = this.getRoot_(svgDoc);
<a name="line328"></a>  if (this.state_ == svgpan.SvgPan.State.PAN &amp;&amp; this.enablePan_) {
<a name="line329"></a>    // Pan mode
<a name="line330"></a>    var p = this.newPoint_(x, y).matrixTransform(this.stateTf_);
<a name="line331"></a>    this.setCtm_(g, this.stateTf_.inverse().translate(
<a name="line332"></a>        p.x - this.stateOrigin_.x, p.y - this.stateOrigin_.y));
<a name="line333"></a>    this.cancelNextClick_ = true;
<a name="line334"></a>  } else if (this.state_ == svgpan.SvgPan.State.DRAG &amp;&amp; this.enableDrag_) {
<a name="line335"></a>    // Drag mode
<a name="line336"></a>    var p = this.newPoint_(x, y).matrixTransform(g.getCTM().inverse());
<a name="line337"></a>    this.setCtm_(this.stateTarget_, this.root_.createSVGMatrix().translate(
<a name="line338"></a>        p.x - this.stateOrigin_.x, p.y - this.stateOrigin_.y).multiply(
<a name="line339"></a>        g.getCTM().inverse()).multiply(this.stateTarget_.getCTM()));
<a name="line340"></a>    this.stateOrigin_ = p;
<a name="line341"></a>  }
<a name="line342"></a>};
<a name="line343"></a>
<a name="line344"></a>
<a name="line345"></a>/**
<a name="line346"></a> * Handle click event.
<a name="line347"></a> * @param {!goog.events.Event} evt The event.
<a name="line348"></a> * @private
<a name="line349"></a> */
<a name="line350"></a>svgpan.SvgPan.prototype.handleMouseDown_ = function(evt) {
<a name="line351"></a>  if (evt.button != 0) {
<a name="line352"></a>    return;
<a name="line353"></a>  }
<a name="line354"></a>  // Prevent selection while dragging.
<a name="line355"></a>  evt.preventDefault();
<a name="line356"></a>  var svgDoc = evt.target.ownerDocument;
<a name="line357"></a>
<a name="line358"></a>  var g = this.getRoot_(svgDoc);
<a name="line359"></a>
<a name="line360"></a>  if (evt.target.tagName == &#39;svg&#39; || !this.enableDrag_) {
<a name="line361"></a>    // Pan mode
<a name="line362"></a>    this.state_ = svgpan.SvgPan.State.PAN;
<a name="line363"></a>    this.stateTf_ = g.getCTM().inverse();
<a name="line364"></a>    this.stateOrigin_ = this.getEventPoint_(evt).matrixTransform(this.stateTf_);
<a name="line365"></a>  } else {
<a name="line366"></a>    // Drag mode
<a name="line367"></a>    this.state_ = svgpan.SvgPan.State.DRAG;
<a name="line368"></a>    this.stateTarget_ = evt.target;
<a name="line369"></a>    this.stateTf_ = g.getCTM().inverse();
<a name="line370"></a>    this.stateOrigin_ = this.getEventPoint_(evt).matrixTransform(this.stateTf_);
<a name="line371"></a>  }
<a name="line372"></a>};
<a name="line373"></a>
<a name="line374"></a>
<a name="line375"></a>/**
<a name="line376"></a> * Handle mouse button release event.
<a name="line377"></a> * @param {!goog.events.Event} evt The event.
<a name="line378"></a> * @private
<a name="line379"></a> */
<a name="line380"></a>svgpan.SvgPan.prototype.handleMouseUp_ = function(evt) {
<a name="line381"></a>  if (this.state_ != svgpan.SvgPan.State.NONE) {
<a name="line382"></a>    this.endPanOrDrag();
<a name="line383"></a>  }
<a name="line384"></a>};
<a name="line385"></a>
<a name="line386"></a>
<a name="line387"></a>/**
<a name="line388"></a> * Ends pan/drag mode.
<a name="line389"></a> */
<a name="line390"></a>svgpan.SvgPan.prototype.endPanOrDrag = function() {
<a name="line391"></a>  if (this.state_ != svgpan.SvgPan.State.NONE) {
<a name="line392"></a>    this.state_ = svgpan.SvgPan.State.NONE;
<a name="line393"></a>  }
<a name="line394"></a>};
<a name="line395"></a>
<a name="line396"></a>
<a name="line397"></a>/**
<a name="line398"></a> * Handle mouse clicks.
<a name="line399"></a> * @param {!goog.events.Event} evt The event.
<a name="line400"></a> * @private
<a name="line401"></a> */
<a name="line402"></a>svgpan.SvgPan.prototype.handleMouseClick_ = function(evt) {
<a name="line403"></a>  // We only set cancelNextClick_ after panning occurred, and use it to prevent
<a name="line404"></a>  // the default action that would otherwise take place when clicking on the
<a name="line405"></a>  // element (for instance, navigation on clickable links, but also any click
<a name="line406"></a>  // handler that may be set on an SVG element, in the case of active SVG
<a name="line407"></a>  // content)
<a name="line408"></a>  if (this.cancelNextClick_) {
<a name="line409"></a>    // Cancel potential click handler on active SVG content.
<a name="line410"></a>    evt.stopPropagation();
<a name="line411"></a>    // Cancel navigation when panning on clickable links.
<a name="line412"></a>    evt.preventDefault();
<a name="line413"></a>  }
<a name="line414"></a>  this.cancelNextClick_ = false;
<a name="line415"></a>};
<a name="line416"></a>
<a name="line417"></a>
<a name="line418"></a>/**
<a name="line419"></a> * Returns the current state.
<a name="line420"></a> * @return {!svgpan.SvgPan.State}
<a name="line421"></a> */
<a name="line422"></a>svgpan.SvgPan.prototype.getState = function() {
<a name="line423"></a>  return this.state_;
<a name="line424"></a>};
</pre>


</body>
</html>
